package com.shisfish.library.Controller;

import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import com.shisfish.library.Impl.UserSingleLendImpl;
import com.shisfish.library.Model.UserSingleLend;
import com.shisfish.library.Utils.Global.GlobalVariable;
import com.shisfish.library.Utils.Global.toJsonUtils;

@Path("userSingleLend")
public class UserSingleLendController extends GlobalVariable {

	private UserSingleLendImpl userSingleLendImpl = new UserSingleLendImpl();
	
	@POST
	@Path("insertOne")
	@Produces("application/json; charset=utf-8")
	public String insertOne(@FormParam("employee") String employee) {
		Map<String, Object> globalMap = new HashMap<String, Object>();
		UserSingleLend userSingleLend = new UserSingleLend(employee, 0, 0, 0, 0, "");
		
		int flag = userSingleLendImpl.insertOne(userSingleLend);
		
		if (flag == 1) {
			globalMap.put("message", ADD_SUCCESS);
		}
		
		return toJsonUtils.map2Json(globalMap);
	}
	
}
